#!/bin/bash

# 启动 PX4 SITL 模拟器
gnome-terminal -- bash -c "export PX4_SIM_HOST_ADDR=192.168.16.13;cd /home/nvidia/demo_ws/PX4-Autopilot/Tools; ./sitl_multiple_run.sh 3; exec bash"

# 启动 MAVROS 节点
gnome-terminal -- bash -c "export PX4_SIM_HOST_ADDR=192.168.16.13;source /opt/ros/foxy/setup.bash; ros2 run mavros mavros_node  --remap __ns:=/drone_0 --ros-args -p fcu_url:=udp://:14540@localhost:14580 -p tgt_system:=1 -p gcs_url:=udp://@192.168.16.236:14550; exec bash"
gnome-terminal -- bash -c "export PX4_SIM_HOST_ADDR=192.168.16.13;source /opt/ros/foxy/setup.bash; ros2 run mavros mavros_node --remap __ns:=/drone_1 --ros-args -p fcu_url:=udp://:14541@localhost:14581 -p tgt_system:=2 -p gcs_url:=udp://@192.168.16.236:14551;exec bash"
gnome-terminal -- bash -c "export PX4_SIM_HOST_ADDR=192.168.16.13;source /opt/ros/foxy/setup.bash; ros2 run mavros mavros_node --remap __ns:=/drone_2 --ros-args -p fcu_url:=udp://:14542@localhost:14582 -p tgt_system:=3  -p gcs_url:=udp://@192.168.16.236:14552; exec bash"
# gnome-terminal -- bash -c "export PX4_SIM_HOST_ADDR=192.168.16.13;source /opt/ros/foxy/setup.bash; ros2 run mavros mavros_node --remap __ns:=/drone_3 --ros-args -p fcu_url:=udp://:14543@localhost:14583 -p tgt_system:=4  -p gcs_url:=udp://@192.168.16.236:14553; exec bash"
# gnome-terminal -- bash -c "export PX4_SIM_HOST_ADDR=192.168.16.13;source /opt/ros/foxy/setup.bash; ros2 run mavros mavros_node  --remap __ns:=/drone_3 --ros-args -p fcu_url:=udp://:14540@localhost:14583 -p tgt_system:=4 -p gcs_url:=udp://@192.168.16.236:14553; exec bash"
# gnome-terminal -- bash -c "export PX4_SIM_HOST_ADDR=192.168.16.13;source /opt/ros/foxy/setup.bash; ros2 run mavros mavros_node --remap __ns:=/drone_4 --ros-args -p fcu_url:=udp://:14541@localhost:14584 -p tgt_system:=5 -p gcs_url:=udp://@192.168.16.236:14554;exec bash"
# gnome-terminal -- bash -c "export PX4_SIM_HOST_ADDR=192.168.16.13;source /opt/ros/foxy/setup.bash; ros2 run mavros mavros_node --remap __ns:=/drone_5 --ros-args -p fcu_url:=udp://:14542@localhost:14585 -p tgt_system:=6  -p gcs_url:=udp://@192.168.16.236:14556; exec bash"


# gnome-terminal -- bash -c "export PX4_SIM_HOST_ADDR=192.168.16.13;source /opt/ros/foxy/setup.bash; ros2 run mavros mavros_node  --remap __ns:=/drone_6 --ros-args -p fcu_url:=udp://:14540@localhost:14586 -p tgt_system:=7 -p gcs_url:=udp://@192.168.16.236:14557; exec bash"
# gnome-terminal -- bash -c "export PX4_SIM_HOST_ADDR=192.168.16.13;source /opt/ros/foxy/setup.bash; ros2 run mavros mavros_node --remap __ns:=/drone_7 --ros-args -p fcu_url:=udp://:14541@localhost:14587 -p tgt_system:=8 -p gcs_url:=udp://@192.168.16.236:14558;exec bash"

